#!/bin/bash

SWNAME=xvkbd

action=$1
if [ "$action" == "" ]; then action=安装; fi

# pwd
. ./scripts/common.sh

if [ "${action}" == "卸载" ]; then
	apt-get remove -y ${SWNAME}
	rm -rf /etc/autoruns/autoruns_after_gui/xvkbd.desktop 2>/dev/null
else
	apt-get install -y ${SWNAME}
	exit_if_fail $? "安装失败"

	STARTUP_SCRIPT_FILE=/usr/bin/zzvkb
	cat <<- EOF > ${STARTUP_SCRIPT_FILE}
		#!/bin/bash
		exec xvkbd -geometry \${RECOMMEND_SCREEN_WIDTH}x600 -compact "\$@"
	EOF
	chmod a+x ${STARTUP_SCRIPT_FILE}

	# 添加到自启动目录
	tmpfile=/etc/autoruns/autoruns_after_gui/xvkbd.desktop
	cat <<- EOF > ${tmpfile}
		[Desktop Entry]
		Name=全键位屏幕键盘
		GenericName=全键位屏幕键盘
		Exec=zzvkb
		Terminal=false
		Type=Application
		Categories=System;Utility;
		Keywords=keyboard;input
	EOF

  echo "安装完成."
  gxmessage -title "提示" "安装完成，重启生效"  -center
fi

: ' 配置说明
man  xvkbd 查看详细的说明

-geometry

'